﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.PlayFromThisLocation.CApStartFromThisLocationEnabler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.PlayFromThisLocation;

internal class CApStartFromThisLocationEnabler : ITxCommandEnabler
{
  public bool Enable => this.CheckEnable();

  private bool CheckEnable()
  {
    bool flag = false;
    TxObjectList items = TxApplication.ActiveSelection.GetItems();
    if (((IEnumerable<ITxObject>) items).Count<ITxObject>() == 1 && !this.IsSimulationRunning && ((Collection<ITxObject>) items)[0] is ITxLocationOperation)
      flag = true;
    return flag;
  }

  private bool IsSimulationRunning
  {
    get => TxApplication.ActiveDocument.SimulationPlayer.IsSimulationRunning();
  }
}
